<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<script type="text/javascript">
    function changeImage() {
        element = document.getElementById("light");
        if (element.src.match("bulbon")) {
            element.src = "pic_bulboff.gif";
        } else {
            element.src = "pic_bulbon.gif";
        }
    }

    function createObject() {
        var obj = new Object();
        obj.name = "毛守君";
        obj.age = 26;
        return obj;
    }

    function checkContent() {
        // var element = document.getElementById("inputNumber").value;
        // if (element == "" || isNaN(element)) {
        //     alert("不是数字");
        // } else {
        //     alert(element);
        // }
        // document.write(Date());
        // var carname = "Volvo";
        // var carname;
        // alert(carname);
        var person = createObject();
        alert(person.name + "---" + person.age);
    }
</script>
<body>
<!-- 	<img id = "light" src = "pic_bulboff.gif"></img>
	<button onclick="changeImage()">点击切换</button> -->
<!--<h1>我的第一段 JavaScript</h1>-->
<!--<p>请输入数字。如果输入值不是数字，浏览器会弹出提示框。</p>-->
<!--<input type="text" name="" id="inputNumber">-->
<!--<button onclick="checkContent()">点击检查</button>-->
<button onclick="checkContent()">点击检查</button>
</body>
</html>